package com.luke.cloud.order.controller;

import com.luke.cloud.order.service.OrderBisService;
import com.luke.cloud.user.service.RemoteUserService;
import com.luke.cloud.user.service.mock.RemoteUserServiceMock;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Descrtption OrderController
 * @Author luke
 * @Date 2020/4/2
 **/
@RestController
@RequestMapping("/order")
public class OrderController {

    /**利用mock处理限流熔断后的结果返回*/
    @Reference(mock = "com.luke.cloud.user.service.mock.RemoteUserServiceMock")
    RemoteUserService userService;

    @Autowired
    private OrderBisService orderBisService;

    @GetMapping("/orderCallUser")
    @ResponseBody
    public String orderCallUser(@RequestParam("message") String message){
        return userService.echo(message);
    }

    @GetMapping("/bizEcho")
    @ResponseBody
    public String bizEcho(@RequestParam("message") String message){
        return orderBisService.bizEcho(message);
    }

}
